package es.pawer.web.checklists.actions;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionSupport;

public abstract class ClientAwareAction extends ActionSupport implements ServletRequestAware {
	
	private static final long serialVersionUID = -339827516103203781L;
	
	public static final String SESSION_USER="USER"; //$NON-NLS-1$
	
	private HttpServletRequest request;
	
	/**
	 * All browsers have the string "Mozilla" in the User-Agent header
	 * @return
	 */
	public boolean isClientABrowser() {
		String user = request.getHeader("User-Agent"); //$NON-NLS-1$
		return user.contains("Mozilla"); //$NON-NLS-1$
	}
	

	@Override
	public void setServletRequest(HttpServletRequest req) {
		this.request=req;
		
	}

}
